/*    */ package xin.petstore.framework.cas;
/*    */ 
/*    */ import java.io.IOException;
/*    */ import javax.servlet.Filter;
/*    */ import javax.servlet.FilterChain;
/*    */ import javax.servlet.FilterConfig;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.ServletRequest;
/*    */ import javax.servlet.ServletResponse;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import org.jasig.cas.client.proxy.ProxyGrantingTicketStorage;
/*    */ import org.jasig.cas.client.proxy.ProxyGrantingTicketStorageImpl;
/*    */ import org.jasig.cas.client.util.CommonUtils;
/*    */ import org.slf4j.Logger;
/*    */ import org.slf4j.LoggerFactory;
/*    */ 
/*    */ public class ProxyCallbackFilter
/*    */   implements Filter
/*    */ {
/* 22 */   protected final Logger logger = LoggerFactory.getLogger(getClass());
/*    */ 
/* 24 */   private ProxyGrantingTicketStorage proxyGrantingTicketStorage = new ProxyGrantingTicketStorageImpl();
/*    */ 
/* 26 */   private String proxyReceptorUrl = "/proxyCallback";
/*    */ 
/*    */   public void setProxyReceptorUrl(String proxyReceptorUrl) {
/* 29 */     this.proxyReceptorUrl = proxyReceptorUrl;
/*    */   }
/*    */ 
/*    */   public void destroy()
/*    */   {
/*    */   }
/*    */ 
/*    */   public void setProxyGrantingTicketStorage(ProxyGrantingTicketStorage storage)
/*    */   {
/* 40 */     this.proxyGrantingTicketStorage = storage;
/*    */   }
/*    */ 
/*    */   public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
/*    */     throws IOException, ServletException
/*    */   {
/* 47 */     HttpServletRequest request = (HttpServletRequest)servletRequest;
/* 48 */     HttpServletResponse response = (HttpServletResponse)servletResponse;
/* 49 */     String requestUri = request.getRequestURI();
/*    */ 
/* 51 */     if (!requestUri.endsWith(this.proxyReceptorUrl)) {
/* 52 */       filterChain.doFilter(request, response);
/* 53 */       return;
/*    */     }
/*    */     try {
/* 56 */       CommonUtils.readAndRespondToProxyReceptorRequest(request, response, 
/* 57 */         this.proxyGrantingTicketStorage);
/*    */     } catch (RuntimeException e) {
/* 59 */       this.logger.error(e.getMessage(), e);
/* 60 */       throw e;
/*    */     }
/*    */   }
/*    */ 
/*    */   public void init(FilterConfig arg0)
/*    */     throws ServletException
/*    */   {
/*    */   }
/*    */ }

/* Location:           C:\java代码反编译器\core-1.1.4.jar
 * Qualified Name:     com.eloancn.framework.cas.ProxyCallbackFilter
 * JD-Core Version:    0.6.0
 */